#include <stdio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <stdlib.h>

void swap(char*);

int main(int argc,char* argv[])
{
  char buf[16];
  scanf("%s",buf);
  swap(buf);

  return 0;
}

void swap(char* buf)
{
  int id_data[4];
  sscanf(buf,"%d.%d.%d.%d",&id_data[0],&id_data[1],&id_data[2],&id_data[3]);

  printf("%u\n",inet_addr(buf));
  printf("%u\n",id_data[3] << 24 | (id_data[2] << 16) | (id_data[1] << 8) | id_data[0]);
}
